home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
print
/
pps213.zip
/
PPS213.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1990-02-08
|
32KB
|
968 lines
{$R-} {Range checking off}
{$B+} {Boolean complete evaluation on}
{$S+} {Stack checking on}
{$I+} {I/O checking on}
{$N+,E+} {numeric coprocessor - or emulation}
{$M 65500,16384,655360} {Turbo 3 default stack and heap}
PROGRAM Postscript;
{ASCII menu driven listing program that generates PostScript
commands to the Apple LaserWriter. Allows selction of
bold and normal fonts, font size and line spacing. Output
can go to a disk file (output.ps) or directly to the printer.
Limitations: Handling tabs is limited to move to an absolute location
on the line. Program is not smart about the actual widths of
characters in different fonts... it just uses an average width per
character of fontsize/2. Epson font change escapes ESC G for bold
and ESC H for normal are used. Spacing for a tab is based on an
average of 8 nominal characters... as a result the tab spacing after
some text with capital letters may not be wide enough and the text
starting after the tab may overlap with previous text. (On the other
hand, the worst case width of 8 widest characters is too large for
normal use).
Can be invoked with filename as a parameter: nlist filename
Free for non-commercial use only.
(C) Copywrite Nate Liskov 27 Jan 1986}
{ Version 1.0 - Original Version
Version 1.1 - Fonts for LaserWriter Plus Added
Version 1.2 - Landscape Format Option Added - Apr 1987
version 1.21 - command line paramters -n= and -b= added to
preset normal and bold fonts
- no headers, no lineffed and output to file are defaults
if command line file has .mem extension
version 1.22 - mar 1988
- option for number of lines added
- fix display of pages printed when page feed off
- capability to print multiple files per invocation added
- apr 88... fix spelling of avantgarde
version 1.23 - apr 1988
- zeroize output.ps option added
version 2.00 - converted to turbo 4.0
version 2.02 - july 1988
- minor bugs corrected
version 2.03 - 9 sept 1988
- correct bug in bold that inserted 2 spaces
version 2.04 - 22 sept 1988
- leave leading blanks in each line vs removing them
thus correcting spacing problems with courier font
- reduce min left hand margin from 45/72 to 36/72 inch
- appears to handle mix of tabs, bold, normal on one line
- tab spacing is 8 times a number character width
note: for all fonts except courier number width =
twice space width
version 2.05 - change spacing for automatic centering
version 2.06 - cleanup of 2.05, display of pitch
version 2.07 - redirect output code changed, change mto to m
- conform to encapsulated postscript
version 2.08 - converted to turbo 5.0, uses turbo3 dropped
version 2.09 - account for actual space widths in breaking up long
- line into several lines
- 28 nov 1988 corrected bug with blank input lines
version 2.10 - 12 dec 1988
- help function added with ? or help command line parameters
- 6 dec 1989
- debugged encapsulated postscript input to wordperfect 5.0
version 2.11 - 24 dec 1988
- add helvetica-condensed fonts
(ti-omnilaser equivalent to helvetica narrow)
- 7 dec 1989
- debugged encapsulated postscript input to wordperfect
version 2.12 - better file handling if input file does not exist
}
Uses
Crt,
Dos,
Printer;
TYPE
DateTimeStr = STRING[26];
OnorOff = ARRAY[1..2] OF STRING[3];
pageform = ARRAY[1..2] OF STRING[9];
fonttype = ARRAY[1..37] OF STRING[28];
outfile = ARRAY[1..2] OF STRING[21];
msg = STRING[127];
maxspaces = STRING[255];
VAR
numberofcopies, linecount, n, m, page, linelength, entryline : integer;
topspaces, bottomspaces, leftmargin, rightmargin, lm, rm : integer;
option : char;
pagestr : STRING[3];
filename : STRING[45];
temp, lineout : STRING[255];
right, left : maxspaces;
source, sink : text;
linesize, header, automatic, maxline : integer;
x,strng : msg;
hellfreezesover,autoexit: boolean;
datetimestamp: datetimestr;
yposition,linesperpage,linespacing,nfont,bfont,currentfont,
nout,pagefeed,fontsize,pagetype : integer;
fontsused:array[1..37]of boolean;
formatsused:array[1..2]of boolean;
CONST
onoff: onoroff = ('On ','Off');
pageformat: pageform = ('Portrait ','Landscape');
font: fonttype = ('Helvetica','Times-Roman','Courier',
'Helvetica-Oblique','Times-Italic','Courier-Oblique',
'Helvetica-Bold','Times-Bold','Courier-Bold',
'Helvetica-BoldOblique','Times-BoldItalic',
'Courier-BoldOblique','AvantGarde-Book',
'AvantGarde-BookOblique','AvantGarde-Demi',
'AvantGarde-DemiOblique','Bookman-Demi',
'Bookman-DemiItalic','Bookman-Light',
'Bookman-LightItalic','Helvetica-Narrow',
'Helvetica-Narrow-Bold',
'Helvetica-Narrow-Oblique',
'Helvetica-Narrow-BoldOblique',
'NewCenturySchlbk-Roman',
'NewCenturySchlbk-Bold','NewCenturySchlbk-Italic',
'NewCenturySchlbk-BoldItalic','Palatino-Roman',
'Palatino-Bold','Palatino-Italic','Palatino-BoldItalic',
'ZapfChancery-MediumItalic','Helvetica-Condensed',
'Helvetica-Condensed-Bold',
'Helvetica-Condensed-Oblique',
'Helvetica-Condensed-BoldObl');
spacewidth: ARRAY [1..37] of real = (0.556,0.5,0.6,0.556,0.5,0.6,
0.556,0.5,0.6,0.556,0.5,0.6,
0.554,0.554,0.554,0.554,0.660,0.660,0.660,0.66,
0.456,0.456,0.456,0.456,0.556,0.556,0.556,0.556,
0.5,0.5,0.5,0.5,0.44,0.456,0.456,0.456,0.456);
{spacewidth is width of space for courier, else
spacewidth is twice width of space which is
same as the width of a number character}
output: outfile = ('Printer','Disk File: Output.ps');
function upword(wrd:msg):msg;
var n:integer;
begin
for n :=1 to length(wrd) do
wrd[n]:=upcase(wrd[n]);
upword := wrd;
end;
FUNCTION spaces(n:integer): maxspaces;
VAR
tmp: STRING[255];
m: integer;
BEGIN
tmp := '';
FOR m :=1 TO n DO
tmp := tmp + ' ';
spaces := tmp;
END;
procedure setlinesize;
begin
IF pagetype = 1 THEN linesize := round(594/(fontsize*spacewidth[nfont]))
ELSE linesize := round(774/(fontsize*spacewidth[nfont]));
if nfont in [3,6,9,12] then
linesize:=linesize else
linesize:=round(linesize*1.04); {fudge factor}
end;
Procedure help;
var foo :char;
begin
clrscr;
writeln(' PPS HELP');
writeln;
writeln(' Command Line Parameters');
writeln;
writeln(' ?, help help on command line parameters');
writeln(' -0=10 sets fontsize to 10');
writeln(' -1=13 sets line spacing to 13');
writeln(' -2 pagefeed commands are in input file (default for .mem file)');
writeln(' -3=25 normal font is font 25');
writeln(' -4=13 bold font is font 13');
writeln(' -5=2 suppress header line (default for .mem file)');
writeln(' -6 output to printer vs output.ps');
writeln(' -7=5 topspaces = 5');
writeln(' -8=7 bottomspaces = 7');
writeln(' -9 automatic margins');
writeln(' -G go, then exit program');
writeln(' -L=12 left margin is 12');
writeln(' -N=7 normal font is font 7');
writeln(' -P landscape page format');
writeln(' -R=12 right margin is 12');
writeln(' -foobar input file is foobar');
halt;
end;
PROCEDURE Alarm;
BEGIN
sound(1000);
delay(500);
nosound;
END;
PROCEDURE Testfile(filename:msg);
var
fileok:boolean;
BEGIN
{$I-}
Reset(s